package com.qyzmt.controller;

import com.qyzmt.pojo.IndexVideo;
import com.qyzmt.pojo.Result;
import com.qyzmt.service.IndexVideoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequestMapping("/api")
@RestController
public class IndexVideoController {

    @Autowired
    private IndexVideoService indexVideoService;

    @GetMapping("/videos")
    public Result videos(){
        log.info("Controller:请求首页视频...");
        List<IndexVideo> indexVideo = indexVideoService.videos();
        log.info("Service返回数据:{}",indexVideo);
        return Result.success(indexVideo);

    }

}
